package edu.pku.sei.mte.mtemodel.mtmodel;

import java.util.ArrayList;
import java.util.List;

import edu.pku.sei.mte.utilities.Visitable;
import edu.pku.sei.mte.utilities.Visitor;

abstract public class Transformation implements Visitable{

	private String name;
	private List<ModelType> modelTypes;

	public Transformation() {
		super();
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<ModelType> getModelTypes() {
		if(modelTypes==null){
			modelTypes = new ArrayList<ModelType>();
		}
		return modelTypes;
	}

	public ModelType getModelType(String name) {
		for(ModelType t : getModelTypes()){
			if(name.equals(t.getName()))
				return t;
		}
		return null;
	}

	public void addModelType(ModelType type) {
		getModelTypes().add(type);
	}

	@Override
	public Object accept(Visitor visitor) throws Exception {
		return visitor.visitTransformation(this);
	}
}